package com.vhall.component.controller.account;


import com.vhall.component.controller.account.facade.AccountFacade;
import com.vhall.component.entity.account.AccountEntity;
import com.vhall.component.entity.account.vo.AccountVO;
import com.vhall.component.entity.account.vo.TouristJudgmentRspVO;
import com.vhall.component.entity.account.vo.TouristJudgmentVO;
import com.vhall.component.framework.common.annotation.VhallComponent;
import com.vhall.component.framework.common.exception.BusinessException;
import com.vhall.component.framework.common.exception.GlobalErrorCode;
import com.vhall.component.service.account.AccountService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 用户表前端控制器
 *
 * @author CodeGenerator
 * @date 2021-04-06 17:09:56
 */
@VhallComponent
public class AccountController implements AccountFacade {

    @Autowired
    private AccountService accountService;

    @Override
    public AccountVO info(String id) {
        AccountEntity account = accountService.getById(id);
        if (account == null) {
            throw new BusinessException(GlobalErrorCode.FAILED);
        }
        AccountVO accountVO = new AccountVO();
        BeanUtils.copyProperties(account, accountVO);
        return accountVO;
    }

    @Override
    public TouristJudgmentRspVO touristJudgment(TouristJudgmentVO touristJudgmentVO) {
        return accountService.touristJudgment(touristJudgmentVO);
    }


}